/**
 * @File   : reducers.js
 * @Author : xue.xiaoBing
 * @Date   : 2020/11/4
 * @Desc   : 定义所有纯reducer
 **/

import {combineReducers} from 'redux'
import * as action_type from './action-types'


// 导航栏当前路由
const initialNavbarMenuState = {
  current: localStorage.getItem('navbar') ?? 'home',
};

const navbarMenu = (state = initialNavbarMenuState, action) => {
  switch (action.type) {
    case action_type.CHANGE_NAVBAR_MENU:
      return {
        current: action.data
      };
    default:
      return state
  }
};


/**
 * 控制 UI 如何展示的数据
 **/
const uiState = combineReducers({
  navbarMenu: navbarMenu,
});


/**
 * 域数据(应用需要展示、使用或者修改的数据)
 **/
// const domainData = combineReducers({
//
// });


/**
 *  应用状态(特定于应用某个行为的数据)
 **/
// const appState = combineReducers({
//
// });


/**
 * 根reducer
 **/
const rootReducer = combineReducers({
  uiState: uiState,
  // appState:appState,
  // domainData:domainData,
});

export default rootReducer
